<template>
  <div class="app-container">
    <div v-if="user">
      <el-row :gutter="20">

        <el-col :span="6" :xs="24">
          <user-card :user="user" />
        </el-col>
        <el-col style="width: 70%;">
          <el-card>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="信息查看" name="activity">
                <activity :user="user" />
              </el-tab-pane>
              <!-- <el-tab-pane label="基础信息" name="timeline">
                <timeline />
              </el-tab-pane> -->
              <el-tab-pane label="安全设置" name="account">
                <account />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { information } from '@/api/teacher.js'
import UserCard from './components/UserCard'
import Activity from './components/Activity'
import Account from './components/Account'

export default {
  name: 'Profile',
  components: { UserCard, Activity, Account },
  data() {
    return {
      user: {},
      major: {},
      activeTab: 'activity'
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'roles'
    ])
  },
  async mounted() {
    await information().then(res => {
      this.user = res.data
    })
  },
  methods: {
  }
}
</script>
